<?php

$files = array();

$dir = opendir('../upload/');
while ($file = readdir($dir)) {
    if ($file == '.' || $file == '..') {
        continue;
    }

    $contents['File'] = is_file('../upload/' . $file) ? $file : NULL;
    $contents['Folder'] = is_dir('../upload/' . $file) ? $file : NULL;
    
    $files[] = $contents;
}

header('Content-type: application/json');
echo json_encode($files);

?>
